/*
 Copyright 2014-Present Algorithms in Motion LLC
 
 This file is part of FDTD++.
 
 FDTD++ is proprietary software: you can use it and/or modify it
 under the terms of the Algorithms in Motion License as published by
 Algorithms in Motion LLC, either version 1 of the License, or (at your
 option) any later version.
 
 FDTD++ is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 Algorithms in Motion License for more details.
 
 You should have received a copy of the Algorithms in Motion License
 along with FDTD++. If not, see <http://www.aimotionllc.com/licenses/>.
*/
// CREATED    : 10/10/2015
// LAST UPDATE: 10/12/2015

#include "statsxx/machine_learning/restricted_Boltzmann_machine/RBM.hpp"

// jScience
#include "jScience/linalg/Vector.hpp" // Vector<>


// basic algorithm for K steps of Gibbs sampling, given a starting vector v
//
// note: the initial vector is used as is (to satisfy that K = 0 returns the starting vector)
//
inline Vector<double> restricted_Boltzmann_machine::RBM::Gibbs(
                                                               const int K,            // number of Markov itertions
                                                               Vector<double> v,       // initial vector v
                                                               const bool mean_field   // mean-field approximation
                                                               ) const
{
    for(int k = 0; k < K; ++k)
    {
        v = this->Gibbs_vhv(
                            v,
                            mean_field
                            );
    }
    
    return v;
}


